﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using StoreHoursDomain.Entity;

namespace WebUI.Models
{
    public class WeeklyStoreHoursViewModel
    {
        public int StoreId { get; set; }
        public int WeeklyID { get; set; }
        public DateTime EffectiveDate { get; set; }
        //public DateTime MondayDate { get; set; }
        //public DateTime TuesdayDate { get; set; }
        //public DateTime WednesdayDate { get; set; }
        //public DateTime ThursdayDate { get; set; }
        //public DateTime FridayDate { get; set; }
        //public DateTime SaturdayDate { get; set; }
        //public DateTime SundayDate { get; set; }
        public StoreHoursViewModel MondayHours { get; set; }
        public StoreHoursViewModel TuesdayHours { get; set; }
        public StoreHoursViewModel WednesdayHours { get; set; }
        public StoreHoursViewModel ThursdayHours { get; set; }
        public StoreHoursViewModel FridayHours { get; set; }
        public StoreHoursViewModel SaturdayHours { get; set; }
        public StoreHoursViewModel SundayHours { get; set; }
        public string EffectiveDateDisplay { get { return EffectiveDate.ToString("MM/dd/yyyy"); } }
        //public string MondayDateDisplay { get { return MondayDate.ToString("MM/dd/yyyy"); } }
        //public string TuesdayDateDisplay { get { return TuesdayDate.ToString("MM/dd/yyyy"); } }
        //public string WednesdayDateDisplay { get { return WednesdayDate.ToString("MM/dd/yyyy"); } }
        //public string ThursdayDateDisplay { get { return ThursdayDate.ToString("MM/dd/yyyy"); } }
        //public string FridayDateDisplay { get { return FridayDate.ToString("MM/dd/yyyy"); } }
        //public string SaturdayDateDisplay { get { return SaturdayDate.ToString("MM/dd/yyyy"); } }
        //public string SundayDateDisplay { get { return SundayDate.ToString("MM/dd/yyyy"); } }

        public static WeeklyStoreHoursViewModel GetWeeklyStoreHoursViewModel(WeeklyStoreHours weeklyStoreHours)
        {
            return new WeeklyStoreHoursViewModel 
            { 
                StoreId = weeklyStoreHours.storeId, 
                WeeklyID = weeklyStoreHours.weeklyID,
                EffectiveDate = weeklyStoreHours.EffectiveDate,
                //MondayDate = weeklyStoreHours.MondayDate,
                //TuesdayDate = weeklyStoreHours.TuesdayDate,
                //WednesdayDate = weeklyStoreHours.WednesdayDate,
                //ThursdayDate = weeklyStoreHours.ThursdayDate,
                //FridayDate = weeklyStoreHours.FridayDate,
                //SaturdayDate = weeklyStoreHours.SaturdayDate,
                //SundayDate = weeklyStoreHours.SundayDate,
                MondayHours = StoreHoursViewModel.GetStoreHoursViewModel(weeklyStoreHours.MondayHours),
                TuesdayHours = StoreHoursViewModel.GetStoreHoursViewModel(weeklyStoreHours.TuesdayHours),
                WednesdayHours = StoreHoursViewModel.GetStoreHoursViewModel(weeklyStoreHours.WednesdayHours),
                ThursdayHours = StoreHoursViewModel.GetStoreHoursViewModel(weeklyStoreHours.ThursdayHours),
                FridayHours = StoreHoursViewModel.GetStoreHoursViewModel(weeklyStoreHours.FridayHours),
                SaturdayHours = StoreHoursViewModel.GetStoreHoursViewModel(weeklyStoreHours.SaturdayHours),
                SundayHours = StoreHoursViewModel.GetStoreHoursViewModel(weeklyStoreHours.SundayHours)
            };
        }
    }
}